local fenbo = fk.CreateSkill{
  name = "mod__fenbo",
  frequency = Skill.Limited,
}
local fenboEffect = {
  anim_type = "special",
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(self) and not player.dead and player:usedSkillTimes(self.name, Player.HistoryGame) == 0
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local players = room.alive_players
    local choices = {"fenbo_turnover", "fenbo_drawcards", "fenbo_gainskill"}
      for _, p in ipairs(players) do
        local all_choices = {"fenbo_turnover", "fenbo_drawcards", "fenbo_gainskill"}
        if p:hasSkill(Fk.skills["zhendu"]) or p:hasSkill(Fk.skills["ol__zhendu"]) then
          table.removeOne(all_choices, "fenbo_gainskill")
        end
        local _data = json.encode({ choices, all_choices, {2, 2}, false, self.name, "#fenbo-ask" })
        p.request_data = _data
      end
      room:notifyMoveFocus(players, self.name)
      room:doBroadcastRequest("AskForChoices", players)
      for _, p in ipairs(players) do
      local replyData = p.reply_ready and p.client_reply or json.encode({"fenbo_turnover", "fenbo_drawcards"})
        local choice = json.decode(replyData) 
        room:sendLog{
          type = "#fenbo_query",
          from = p.id,
          arg = choice[1],
          arg2 = choice[2],
        }
        if table.contains(choice, "fenbo_turnover") then
          p:turnOver()
        end
        if table.contains(choice, "fenbo_drawcards") then
          p:drawCards(2, self.name)
        end
        if table.contains(choice, "fenbo_gainskill") then
          room:handleAddLoseSkills(p, "ol__zhendu", nil)
          room.logic:getCurrentEvent():findParent(GameEvent.Round):addCleaner(function()
            room:handleAddLoseSkills(p, "-ol__zhendu")
          end)
        end
        room:delay(200)
      end
  end,
}
fenbo:addEffect(fk.RoundStart, fenboEffect)
Fk:loadTranslationTable{
  ["mod__fenbo"] = "纷殕",
  [":mod__fenbo"] = "限定技，每轮开始时，你可以令所有角色同时选择两项：翻面;摸两张牌;本轮获得【鸩毒】。",
  ["#fenbo-ask"] = "纷殕：选择两项",
  ["fenbo_turnover"] = "翻面",
  ["fenbo_drawcards"] = "摸两张牌",
  ["fenbo_gainskill"] = "本轮获得“鸩毒”",
  ["#fenbo_query"] = "%from 选择 %arg 与 %arg2",
}
return fenbo